
#include "main.h"
#include "debug.h"
#include "include_other.h"


#define HOME_VIDEO_PATH  	   		("/home/Videos")

#define MEDIA_VIDEO_PAHT_10   	    ("/media/Res/10")

#define MEDIA_VIDEO_PAHT_30   	    ("/media/Res/30")

#define MEDIA_VIDEO_PAHT_60   	    ("/media/Res/60")

#define MEDIA_VIDEO_PAHT_FAVE       ("/media/Res/fave")

#define MEDIA_VIDEO_PAHT       		("/media/Res")

//**********************************************************

static pthread_t  main_timer_thread;

//**********************************************************


void* main_timer_task(void *arg)
{

	struct timeval timer;	

	while(1)
	{
		usleep(1000);

		timer.tv_sec  = 1;
		timer.tv_usec = 0;

		switch(select(0, NULL, NULL, NULL, &timer)) 
		{
		case -1:  
			log_e("Error!\n");
			break;
		case 0: 
			break;
		default:break;
		}
	}
}


int main(int argc, char *argv[])
{
	int i     = 0;
	int ret   = 0;

	log_i("------rkmpp player ------\n");
	
	system_para_default();

	parameter_parsing(argc,argv);

	lvgl_gui_init();

	//net_init();
	
	jpeg_show_test();

    while(1)
	{
		usleep(10);
    }

	return 0;


	sync_mutex_init();
	video_mutex_init();
	audio_mutex_init();
	
	queue_packet_init();
	queue_audio_pcm_init();

	key_mouse_init();

	lib_alsa_init();
	lib_bmp_init();
	lib_drm_init();
	
	lib_jpeg_init();
	lib_mpp_init();
	lib_png_init();
	lib_rga_init();
	lib_sdl2_init();
	
	lib_ffmpeg_init();


	if(video_para_get_path() == 0)
	{
		file_create_list(HOME_VIDEO_PATH);
	}
	else if(video_para_get_path() == 1)
	{
		file_create_list(MEDIA_VIDEO_PAHT_10);
	}
	else if(video_para_get_path() == 2)
	{
		file_create_list(MEDIA_VIDEO_PAHT_30);
	}	
	else if(video_para_get_path() == 3)
	{
		file_create_list(MEDIA_VIDEO_PAHT_60);
	}
	else if(video_para_get_path() == 4)
	{
		file_create_list(MEDIA_VIDEO_PAHT_FAVE);
	}
	else
	{
		file_create_list(HOME_VIDEO_PATH);
	}

	ret=pthread_create(&main_timer_thread, NULL, main_timer_task, NULL);
	if(ret != 0){
		log_e("thread error=%s\n",strerror(ret));
	}


    while(1)
	{
		usleep(10);
    }

	video_mutex_deinit();
	audio_mutex_deinit();
	sync_mutex_deinit();

	lib_alsa_deinit();
	lib_bmp_deinit();
	lib_drm_deinit();
	lib_ffmpeg_deinit();
	lib_jpeg_deinit();
	lib_mpp_deinit();
	lib_png_deinit();
	lib_rga_deinit();
	lib_sdl2_deinit();
	queue_packet_deinit();
	queue_audio_pcm_deinit();
	file_delete_list();

	key_mouse_deinit();

    return 0;
}

